package com.x.erp.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.x.erp.model.Manufacturer;
import com.x.erp.rpc.ManufacturerRpcService;
import com.x.framework.controller.BaseController;
import com.x.framework.controller.ResultCode;
import com.x.framework.controller.ResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by hailongli on 2018/6/4.
 */
@RestController
public class ManufacturerController extends BaseController {
    @Reference
    private ManufacturerRpcService manufacturerRpcService ;

    /**
     * 获取厂商列表
     *
     * @param manufacturer
     * @return
     */
    @RequestMapping(value = "/getManufacturerList", method = { RequestMethod.POST, RequestMethod.GET })
    public ResultModel getManufacturerList(Manufacturer manufacturer) {
        List<Manufacturer> list = manufacturerRpcService.selectManufacturer(manufacturer);
        return new ResultModel(ResultCode.RESULT_SUCCESS, "查询成功", list);
    }
}
